package admin.dao;

import util.MysqlUtil;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class AdminDao {
    public void studenSelect() {
        try {
            Statement jbdc = MysqlUtil.JBDC();
            String sql = "select * from admin_student";
            ResultSet resultSet = jbdc.executeQuery(sql);
            while (resultSet.next()) {
                String studentName = resultSet.getString("student_name");
                String studentSex = resultSet.getString("student_sex");
                String studentClass = resultSet.getString("student_class");
                String studentTeacher = resultSet.getString("student_teacher");
                System.out.println(" ");
                System.out.print("学生姓名：" + studentName);
                System.out.print(" 学生性别：" + studentSex);
                System.out.print(" 学生班级：" + studentClass);
                System.out.println(" 指导老师：" + studentTeacher);
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
        public void studenttimetable() {
            try {
                Statement jbdc = MysqlUtil.JBDC();
                String sql = "select * from student_timetable";
                ResultSet resultSet = jbdc.executeQuery(sql);
                while (resultSet.next()) {
                    String date = resultSet.getString("date");
                    String first = resultSet.getString("first");
                    String second = resultSet.getString("second");
                    String third = resultSet.getString("third");
                    String fourth = resultSet.getString("fourth");
                    System.out.println(" ");
                    System.out.print("星期：" + date);
                    System.out.print(" 第一节课：" + first);
                    System.out.print(" 第二节课：" +second);
                    System.out.print(" 第三节课：" + third);
                    System.out.println(" 第四节课："+fourth);
                }
            } catch (SQLException e) {
                throw new RuntimeException(e);
            }

        }
    public void teacherSelect() {
        try {
            Statement jbdc = MysqlUtil.JBDC();
            String sql = "select * from admin_teacher";
            ResultSet resultSet = jbdc.executeQuery(sql);
            while (resultSet.next()) {
                String date = resultSet.getString("teacher_name");
                String first = resultSet.getString("teacher_sex");
                String second = resultSet.getString("teacher_class");
                String third = resultSet.getString("teacher_subject");
                System.out.println(" ");
                System.out.print("老师姓名：" + date);
                System.out.print(" 老师性别：" + first);
                System.out.print(" 老师班级：" +second);
                System.out.println(" 指导科目：" + third);
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
    public void teachertimetable() {
        try {
            Statement jbdc = MysqlUtil.JBDC();
            String sql = "select * from teacher_timetable";
            ResultSet resultSet = jbdc.executeQuery(sql);
            while (resultSet.next()) {
                String teacherName = resultSet.getString("teacher_name");
                String teacherSubject = resultSet.getString("teacher_subject");
                String teacherTime = resultSet.getString("teacher_time");
                String teacherSite = resultSet.getString("teacher_site");
                System.out.println(" ");
                System.out.print("老师姓名：" + teacherName);
                System.out.print(" 老师性别：" + teacherSubject);
                System.out.print(" 老师班级：" +teacherTime);
                System.out.println(" 指导科目：" + teacherSite);
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }


    }